//
//  JHDataStorage.h
//  MiniWeChat
//
//  Created by ByteDance on 2025/6/25.
//
#import <Foundation/Foundation.h>

@protocol JHDataStorage <NSObject>

@required
// 基本 CRUD
- (BOOL)saveObject:(id<NSObject>)object forKey:(NSString *)key error:(NSError **)error;
- (id)fetchObjectForKey:(NSString *)key error:(NSError **)error;
- (BOOL)updateObject:(id<NSObject>)object forKey:(NSString *)key error:(NSError **)error;
- (BOOL)deleteObjectForKey:(NSString *)key error:(NSError **)error;

// 批量操作
- (BOOL)saveObjects:(NSArray<id<NSObject>> *)objects withPrefix:(NSString *)prefix error:(NSError **)error;
- (NSArray *)fetchObjectsWithPrefix:(NSString *)prefix error:(NSError **)error;

// 连接与状态管理
- (BOOL)connectWithError:(NSError **)error;
- (void)disconnect;
- (BOOL)isConnected;

@end
